<template>
    <table class="table table-bordered table-striped">
        <!-- 标题区域 -->
        <thead>
            <tr>
                <slot name="header"></slot>
            </tr>
        </thead>
        <!-- 主体内容区域 -->
        <tbody>
            <tr v-for="(item, index) in data" :key="item.id">
                <slot name="body" :row="item" :index="index"></slot>
            </tr>
        </tbody>
    </table>
</template>

<script>
export default {
    name: "common-table",
    props: {
        data: {
            type: Array,
            required: true,
            default: []
        }
    }
}
</script>

<style>
</style>